package com.heqiang.spring.factory;

import com.heqiang.spring.config.SingletonBeanRegistry;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class DefaultSingletonBeanRegistry implements SingletonBeanRegistry {

    Map<String, Object> singletonBeanMap = new ConcurrentHashMap<>();

    @Override
    public Object getSingleton(String name) {
        return singletonBeanMap.get(name);
    }

    protected void addSingleton(String name,Object bean){
        singletonBeanMap.put(name, bean);
    }
}
